<template>
	<view class="">
		<view class=" bgcf cart-box">
			<view class="df aic  cdxx-box fs24 c3 fwb " v-if="platformFeeInfo.sendLimit">
				<view class="cdxx mr10">凑单提示</view>
				<view class="" style="width: 460rpx;">
					<text class="app-theme fwb m010">平台配送</text>满{{platformFeeInfo.sendLimit}}元配送,还差{{platformFeeInfo.diff}}元
					<u-icon name="question-circle" color="#48A147" class="ml5" @click="$emit('feeInfo')"></u-icon>
				</view>
				<view class="cdxx-right price" @click="goHome()">
					去凑单 <nmr-icon name="xiangyou1" size="22" color="#666666"></nmr-icon>
				</view>
			</view>
			<view class="content ">
				<view class="df aic jcsb">
					<view class="df aic jcsb" style="width: 500rpx;">
						<view class="df aic">
							<u-checkbox style="width: 50rpx;" @change="checkChange" active-color="#48A147" shape="circle"
								v-model="checked"></u-checkbox>
								<view class="c3 fs28 ">全选</view>
						</view>
						<view class="fs28" v-if="!isEdit" @click="handleViewPrice">
							<view class="">
								<text class="c3 fs28">合计：</text><text class="price fs24">￥</text><text class="price fs32 fw5">{{payAmountFee||0}}</text>
								<text class="price fs22 ml5">明细</text><u-icon name="arrow-down" color="#EF2929" size="22"></u-icon>
							</view>
							<view class="">
								<text class="c3 fs28">含配送费：</text><text class="app-theme fs24">￥</text><text class="app-theme fs24 fw5">{{sendPirce||0}}</text>
							</view>
						</view>
					</view>
					<view class="" v-if="!isEdit">
						<u-button hair-line @click="handlesubmit" :loading="loading"
							:custom-style="{fontSize: '26rpx', color: '#ffffff',width: '160rpx',height: '68rpx',background: 'linear-gradient(90deg, #48A147 0%, #8AE38A 100%);'}"
							shape='circle' ripple>结算({{checkNum||0}})</u-button>
					</view>
					<view class="df aic" v-else>
						<!-- <u-button hair-line @click="handlesubmit" :loading="loading"
							:custom-style="{marginRight:'20rpx',fontSize: '26rpx', color: '#ffffff',width: '160rpx',height: '68rpx',background: 'linear-gradient(90deg, #48A147 0%, #8AE38A 100%);'}"
							shape='circle' ripple>加入收藏</u-button> -->
						<u-button hair-line @click="handleDele" :loading="loading"
							:custom-style="{fontSize: '26rpx', color: '#ffffff',width: '160rpx',height: '68rpx',background: '#FF4500'}"
							shape='circle' ripple>删除</u-button>
					</view>
				</view>
			</view>
		</view>
		<view class="" :style="{'height':120+(platformFeeInfo.sendLimit?70:0)+'rpx'}"></view>
	</view>
</template>

<script>
	import Decimal from "decimal.js";
	export default {
		props: ['item','isEdit',"checkNum","priceAll","checked","sendPirce","platformFeeInfo"],
		data() {
			return {
				loading: false,
			}
		},
		computed:{
			payAmountFee(){
				let priceAll = new Decimal(this.priceAll);
				const deliveryFee = new Decimal(Number(this.sendPirce));
				return new Decimal(priceAll.add(deliveryFee)).toFixed(2)
			}
		},
		methods: {
			goHome() {
				uni.switchTab({
					url: '/pages/class/index'
				})
			},
			checkChange(e) {
				this.$emit('selectAll', e.value)
			},
			handleDele(){
				this.$emit('handleDele')
			},
			handlesubmit() {
				this.$emit('handlesubmit')
			},
			handleViewPrice(){
				this.$emit('handleViewPrice')
			}
		}
	}
</script>
<style lang="scss" scoped>
	$theme-text: #47A848;

	.cart-box {
		width: 100%;
		position: fixed;
		z-index: 1205;
		bottom: 0;
		box-shadow: 0rpx 0rpx 4rpx 1rpx rgba(0,0,0,0.16);
		.content {
			margin: 17rpx 30rpx;
		}

	}
	.cdxx{
		text-align: center;
		font-size: 24rpx;
		padding: 3rpx 10rpx;
		color:white;
		background: #EF2929;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
	}
	.cdxx-box{
		padding:20rpx 20rpx 0;
		border-bottom: 2rpx solid #E5E5E5;
		padding-bottom: 15rpx;
		.cdxx-right{
			margin-left: auto;
		}
	}
</style>